package com.education.welco.controller.app;


import com.education.common.core.BaseController;
import com.education.common.utils.ApiReturnObject;
import com.education.welco.pojo.SCatalogPreview;
import com.education.welco.pojo.SCatalogWork;
import com.education.welco.service.ISCatalogPreviewService;
import com.education.welco.service.ISCatalogWorkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 课程预习 信息操作处理
 *
 * @author d
 * @date 2020-05-08
 */
@Api(tags = {"APP-学校课程--作业"})
@RestController
@RequestMapping("/app/sCatalogWork")
public class AppSCatalogWorkController extends BaseController {


    @Autowired
    private ISCatalogWorkService catalogWorkService;

    @ApiOperation(value = "学校课程--作业接口", httpMethod = "GET")
    @GetMapping("/selectByWork")
    public ApiReturnObject selectByWork(Integer catalogId, Integer classId) {
        if (null != catalogId) {
            SCatalogWork work = new SCatalogWork();
            work.setClassId(classId);
            work.setCatalogId(catalogId);
            work.setIsStu("1");//是否允许学生查看 1 是 0 否
            List<SCatalogWork> catalogWorkList = catalogWorkService.selectSCatalogWorkList(work);
            return new ApiReturnObject("200","查询成功",catalogWorkList.size(),catalogWorkList);
        } else {
            return new ApiReturnObject("201", "catalogId为空", "catalogId为空");
        }
    }

}